import com.sw.basedemo.consumer.ConsumerComponent;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import java.io.IOException;

/**
 * @author sw
 */
public class AnnotationConsumerMain {

    public static void main(String[] args) throws IOException {
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
        context.start();
        ConsumerComponent consumerComponent=context.getBean(ConsumerComponent.class);
        while (true){
            System.in.read();
            String sayHello = consumerComponent.sayHello("您好");
            System.out.println("result:"+sayHello);
        }
    }
    @Configuration
    @EnableDubbo(scanBasePackages = "com.sw.basedemo.api")
    @PropertySource("classpath:/dubbo-consumer.properties")
    @ComponentScan(value = {"com.sw.basedemo.consumer"})
    static class ConsumerConfiguration{

    }
}
